package day9;

import java.awt.image.BandCombineOp;

public class AccountManager {
	// 余额
	private Double balance;
	
	public AccountManager(Double balance) {
		this.balance = balance;
	}
	
	public void deposit(Double money) {
		this.balance += money;
	}
	
	// 这里会抛出编译时异常，当调用withdraw方法时候就要处理这个编译时异常
	public void withdraw(Double money) throws MeiQianException {
		if (balance >= money) {
			balance -= money;
		} else {
			Double needMoney = money - balance;
			throw new MeiQianException("还差多少钱" + needMoney);
		}
	}

}
